package api

import (
	"gitee.com/hexug/vblog/tree/master/api/apps"
	"gitee.com/hexug/vblog/tree/master/api/apps/tag"
	"gitee.com/hexug/vblog/tree/master/api/middleware"
	"github.com/gin-gonic/gin"
)

type TagApi struct {
	Svc tag.Server
}

func (a *TagApi) Name() string {
	return tag.AppName
}

func (a *TagApi) Init() error {
	a.Svc = apps.GetApp(a.Name()).(tag.Server)
	return nil
}

func (a *TagApi) RegisterRouter(router gin.IRouter) {
	router.GET("/", a.GetTag)

	router.Use(middleware.MidAuth)
	router.POST("/", a.CreateTag)
	router.DELETE("/", a.DeleteTag)
	router.PATCH("/", a.UpdateTag)
}

func init() {
	apps.RegisterApi(&TagApi{})
}
